package cn.qqncn.furniture.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 *
 *
 * @Package: com.*.*.config
 * @ClassName: LoginConfig
 * @Description:拦截器配置
 * @author: zk
 * @date: 2019年9月19日 下午2:18:35
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    //TODO 拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册TestInterceptor拦截器

        InterceptorRegistration registration = registry.addInterceptor(new AdminInterceptor());
        registration.addPathPatterns(
                "/**"   //所有路径都被拦截
//                "/back/**",
//                "/toMyAccount"
        );
        //添加不拦截路径
        registration.excludePathPatterns(
                                         "/back_no_login.jsp",
                                         "/back/login.jsp",
                                         "/front/index.jsp",
                                         "/front/login-register.jsp",
                                         "/shop",
                                         "/furniture/**",
                                         "/back/admin/login",
                                         "/category/**",
                                         "/order/getBar",
                                         //静态资源
                                         "/user/*",
                                         "/front/assets/**",
                                         "/front/css/**",
                                         "/front/js/**",
                                         "/front/component/js/**",
                                         "/back/images/**"
                                         );
    }
}